package com.kjs.execptionless;


import com.kjs.common.resultModel.JsonResult;
import org.springframework.http.HttpStatus;

/**
 * Created by zmk523@163.com on 2019/6/21 14:17
 */

public class BusinessException extends RuntimeException {
    private int code;   //返回码 非0即失败
    private String msg; //消息提示

    protected HttpStatus statusCode = HttpStatus.INTERNAL_SERVER_ERROR;


    public BusinessException(JsonResult jsonResult) {
        this.code = jsonResult.getCode();
        this.msg = jsonResult.getMsg();
    }

    public BusinessException(Integer code, String message) {
        this.code = code;
        this.msg = message;
    }

    public BusinessException(Integer code, String message, Exception ex) {
        this.code = code;
        this.msg = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}